home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-07-15 | 2.9 KB | 109 lines | [TEXT/MPS ] |
- //=======================================================================================
- //
- // Utils.c - Various utility routines for SHDemo
- //
- // Written by Bryan K. Ressler (Beaker), 2/4/92
- //
- // Version 1.00, 2/4/92 Original version
- // 1.10, 4/11/92 Integrate final Sound Helper, clean up
- //
- //=======================================================================================
-
- //=======================================================================================
- // Includes
- //=======================================================================================
- #include "Std.h"
- #include "SHDemo.h"
-
- //=======================================================================================
- void UseCursor(short cursID)
- {
- CursHandle curs = nil;
-
- if (cursID != 0)
- curs = GetCursor(cursID);
-
- if (curs)
- SetCursor(*curs);
- else SetCursor(&qd.arrow);
- }
-
- //=======================================================================================
- void InvalItem(DialogPtr theDialog,short itemNum)
- {
- short aType;
- Rect aBox;
- Handle theItem;
-
- GetDItem(theDialog,itemNum,&aType,&theItem,&aBox);
- InvalRect(&aBox);
- }
-
- //=======================================================================================
- void SetValue(DialogPtr theDialog,short itemNum,short value)
- {
- short aType;
- Rect aBox;
- Handle theItem;
-
- GetDItem(theDialog,itemNum,&aType,&theItem,&aBox);
- SetCtlValue((ControlHandle)theItem,value);
- }
-
- //=======================================================================================
- void ErrorAlert(short strNum)
- {
- Str255 parm;
- char blank = 0;
-
- GetIndString(parm, kErrStrs, strNum);
- ParamText(parm, &blank, &blank, &blank);
- StopAlert(kErrAlert, nil);
- }
-
- //=======================================================================================
- void ErrorExtra(short strNum, short err)
- {
- Str255 parm0, parm1;
- char blank = 0;
-
- GetIndString(parm0, kErrStrs, strNum);
- NumToString((long)err, parm1);
- ParamText(parm0, parm1, &blank, &blank);
- StopAlert(kErrExtraAlert, nil);
- }
-
- //=======================================================================================
- void UserItem(DialogPtr theDialog,short itemNum,
- pascal void (*theProc)(WindowPtr theWindow,short itemNum))
- {
- short theType;
- Rect theBox;
- Handle theItem;
-
- GetDItem(theDialog, itemNum, &theType, &theItem, &theBox);
- SetDItem(theDialog, itemNum, theType, (Handle)theProc, &theBox);
- }
-
- //=======================================================================================
- void EnCtrl(DialogPtr theDialog,short itemNum)
- {
- short aType;
- Rect aBox;
- Handle theItem;
-
- GetDItem(theDialog,itemNum,&aType,&theItem,&aBox);
- HiliteControl((ControlHandle)theItem,0);
- }
-
- //=======================================================================================
- void DisCtrl(DialogPtr theDialog,short itemNum)
- {
- short aType;
- Rect aBox;
- Handle theItem;
-
- GetDItem(theDialog,itemNum,&aType,&theItem,&aBox);
- HiliteControl((ControlHandle)theItem,255);
- }
-